#给数据库传入列表内容
stulist=[{'账户':'1001','密码':'1','账号余额':'12345'},
		 {'账户':'1002','密码':'2','账号余额':'3260'},
		 {'账户':'1003','密码':'3','账号余额':'19312451255'}
		]
#显示账户信息
def fun(j):
	global stulist
	print("{0:<4}".format("账户"))
	print("{:<20}".format(stulist[j]['账户']))
	print("{:<5}".format('账号余额'))
	print("{:<20}".format(stulist[j]['账号余额']))
#取钱
def fun2(j):
	d=int(input("请输入要取出的钱的数目:"))
	e=int(stulist[j]['账号余额'])
	e=e-d
	stulist[j]['账号余额']=str(e)
	fun(j)
#存钱
def fun3(j):
	f=int(input("请输入要存入的钱的数目:"))
	g=int(stulist[j]['账号余额'])
	g=g+f
	stulist[j]['账号余额']=str(g)
	fun(j)
#输出初始界面
while True:
	print("="*20,"德意志银行","="*20)
	print("欢迎使用德意志银行自助ATM存取款机")
	print("="*52)
    #输入账号以及密码
	a=input("请登录账户:")
	b=input("请输入密码:")
	for j in range(len(stulist)):
		k=0
		if a==stulist[j]['账户']:
			k=1
			if b==stulist[j]['密码']:
				print("{0:2}{1:5}{2:2}{3:3}{4:2}{5:3}{6:2}{7:4}".format("1","查询余额","2","取钱","3","存钱","4","退出登录"))
				while True:
					c=input("请输入操作代码：")
					if c=="1":
						fun(j)
					elif c=="2":
						fun2(j)
					elif c=="3":
						fun3(j)
					elif c=="4":
						print("再见沙雕")
						break
					else:
						print("不存在该代码：")
						break
			else:
				print("该账户名密码错误")
				break
		else:
			if j==2:
				if k==0:
					print("该账户不存在")
					break
				else:
					break

			





